package com.qf.config;

import com.qf.common.interceptor.JwtTokenAdminHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {
    @Autowired
    private JwtTokenAdminHandler jwtTokenAdminHandler;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        System.out.println("自定义拦截器启动--------------------------------------");
        //拦截所有，但排除登录
        registry.addInterceptor(jwtTokenAdminHandler)
                .addPathPatterns("/**")
                .excludePathPatterns("/user/login","/user/getImageCode","/user/register","/user/permission");
    }
}
